<template>
<slot :controller="controller" :store="store" :model="model" >
        <div :class="classNames" :id="controlID">
        </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@PANEL}}-panel/{{spinalCase ctrl.codeName}}-panel-base.vue.hbs生成

import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
import { IContext, IParam, createUUID, ILoadingHelper, ICtrlDataAction,IViewCtx, IEvent } from "@/core";
import { useProps, useBasic, useController } from './app-panel-view-2-Panel-hook';
import { PanelActionType, IPanelAbility, IPanelStore, IViewLogicInput } from "@/core/interface";

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { controlID, getClassNames, model ,useNavParamsBind, useEventBind, handleComponentAction } = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: PanelActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IPanelAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
  return getClassNames(props);
});

//  面板部件控制器
const controller = useController(props, evt, { controlID });

useNavParamsBind(controller, props);

const store: IPanelStore = controller.getStore();

onMounted(() => {
    controller.ctrlMounted();
});
onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>